update test suite for change
authorJoey Hess <joeyh@joeyh.name>
Thu, 21 Aug 2025 20:35:51 +0000 (16:35 -0400)
committerJoey Hess <joeyh@joeyh.name>
Thu, 21 Aug 2025 20:35:51 +0000 (16:35 -0400)
fd89e611b2310b46368c91bcd79999b0ba8462a3 changed the exit code of
git-annex sync which broke the test suite

I'm actually a bit surprised that this test's export works after the
sync fails. huh

Test.hs
Test/Framework.hs

diff --git a/Test.hs b/Test.hs
index 2fb6d6a03b3f5c706445aa365a6f3ab262fe5826..bf09dd7d559ea8894f69335e47dfc1680926451b 100644 (file)
--- a/Test.hs
+++ b/Test.hs
@@ -2085,7 +2085,12 @@ test_export_import = intmpclonerepo $ do
        removeWhenExistsWith removeFile (literalOsPath "import")
        writecontent "import" (content "newimport3")
        git_annex "add" ["import"] "add of import"
-       commitchanges
+       ifM onAdjustedBranch
+               -- On an adjusted branch, sync fails when there is a merge
+               -- commit in history.
+               ( git_annex_shouldfail "sync" commitchangesparams "sync"
+               , commitchanges
+               )
        git_annex "export" [origbranch, "--to", "foo"] "export after import conflict"
        dircontains "import" (content "newimport3")
   where
@@ -2097,7 +2102,8 @@ test_export_import = intmpclonerepo $ do
        -- When on an adjusted branch, this updates the master branch
        -- to match it, which is necessary since the master branch is going
        -- to be exported.
-       commitchanges = git_annex "sync" ["--no-pull", "--no-push", "--no-content"] "sync"
+       commitchanges = git_annex "sync" commitchangesparams "sync"
+       commitchangesparams = ["--no-pull", "--no-push", "--no-content"]
 
 test_export_import_subdir :: Assertion
 test_export_import_subdir = intmpclonerepo $ do
index a0dd71052233822bf6af32be40b44ae7a2cf3e7d..09ffe0a26df88941592f5676db128ffd8772ed65 100644 (file)
@@ -535,6 +535,9 @@ testMode opts v = TestMode
 hasUnlockedFiles :: TestMode -> Bool
 hasUnlockedFiles m = unlockedFiles m || adjustedUnlockedBranch m
 
+onAdjustedBranch :: IO Bool
+onAdjustedBranch = adjustedUnlockedBranch <$> getTestMode
+
 withTestMode :: TestMode -> TestTree -> TestTree
 withTestMode testmode = withResource prepare release . const
   where